package com.xxb.system.user.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.xxb.common.result.R;
import com.xxb.system.feign.dto.user.LoginReqFeignDTO;
import com.xxb.system.feign.dto.user.LoginRespFeignDTO;
import com.xxb.system.feign.service.user.UserServiceFeign;
import com.xxb.system.user.service.IUserService;
import com.xxb.system.user.vo.LoginReqVO;
import com.xxb.system.user.vo.LoginRespVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author RenGaoshuai
 * @date 2023/7/20 18:25
 * @description
 */
@Service
@Slf4j
public class UserServiceImpl implements IUserService {

    @Autowired
    private UserServiceFeign userServiceFeign;

    @Override
    public LoginRespVO login(LoginReqVO loginVo) {
        LoginReqFeignDTO feignReqDTO = BeanUtil.copyProperties(loginVo, LoginReqFeignDTO.class);
        R<LoginRespFeignDTO> result = userServiceFeign.login(feignReqDTO);
        return BeanUtil.copyProperties(result.getData(),LoginRespVO.class);
    }
}
